Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parsing support for the QNX platform Coredump's thread ids format and fixed VSCODE .devcontainer compilation failure #1398

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

khvysofq
Copy link

@khvysofq khvysofq commented May 3, 2023

This PR fixes two issues.

  1. It fixes the compilation error issue in vscode/.devcontainer. The .Net version in the Docker image in the current version is different from the .Net version used in the actual main branch, and it is not possible to generate the latest available compilation image correctly through the Dockerfile. The fix uses a fixed .Net official image, the Linux platform version, and does not require the installation of gcc-related tools, so it can be compiled directly. https://github.com/microsoft/vscode-dev-containers/tree/main/containers/dotnet
  2. It adds support for the parsing format of Thread ID in QNX Coredump. The format of threads in Coredump in the QNX platform is "pid <pid> tid <pid>", e.g., "pid 4194373 tid 308", and this format is currently not supported.

@khvysofq
Copy link
Author

khvysofq commented May 3, 2023

@microsoft-github-policy-service agree

@khvysofq khvysofq changed the title Add supporting for parse QNX coredumps thread's id format and fixed bulid error in vscode .devcontainer Added parsing support for the QNX platform Coredump's thread ids format and fixed VSCODE .devcontainer compilation failure May 3, 2023
@@ -44,7 +44,7 @@ internal class ThreadCache
private List<DebuggedThread> _deadThreads;
private List<DebuggedThread> _newThreads;
private Dictionary<string, List<int>> _threadGroups;
private static uint s_targetId = uint.MaxValue;
private static uint s_targetId = 0; // Thread ids should be start at 0 in the default scenario
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you talk about why you changed this part? Unfortunately there are no comments to say for sure, but I think the idea of starting with uint.MaxValue was to select something that was highly unlikely to clash with actual thread ids in the case that the thread id couldn't be parsed.

This code was added in commit 12632f3280da94787c009c8a97accbe797ac6994, but the author didn't add any more details, and I am sure the author no longer remembers.

{
// In QNX gdb coredumps the thread name is in the form:"pid <pid> tid <pid>", eg "pid 4194373 tid 308"
int tid_pos = targetId.IndexOf("tid ", StringComparison.Ordinal);
int len = targetId.Length - (tid_pos + 4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to put the rest of this block in if (tid_pos >= 0)

// In QNX gdb coredumps the thread name is in the form:"pid <pid> tid <pid>", eg "pid 4194373 tid 308"
int tid_pos = targetId.IndexOf("tid ", StringComparison.Ordinal);
int len = targetId.Length - (tid_pos + 4);
if (len > 0 && System.UInt32.TryParse(targetId.Substring(tid_pos + 4, len), out tid) && tid != 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Use a constant for tid and use '<const_name>.Length` instead of '4' so it is obvious what the '4' means.

Example:

const string tidPrefix = "tid ";
int tid_pos = targetId.IndexOf(tidPrefix, ...)
int len = targetId.Lenth - (tid_pos + tidPrefix.Length);
if (... && UInt32.TryParse(targetId.Substring(tid_pos + tidPrefix.Length...)

"image":"mcr.microsoft.com/vscode/devcontainers/dotnet:6.0-focal",
"remoteUser": "root"
// "postCreateCommand": "",
// "build": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just delete the commented out code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants